using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;
using System.Collections;

namespace ResourceBlender_Express {
    /// <summary>
    /// A translation used by one or more resources
    /// </summary>
    public class RBTranslation {
        /// <summary>
        /// Gets or sets the translated text.
        /// </summary>
        /// <value>The translation.</value>
        public string Translation { get; set; }
        /// <summary>
        /// Gets or sets the comment.
        /// </summary>
        /// <value>The comment.</value>
        public string Comment { get; set; }

        /// <summary>
        /// Initializes a new <see cref="RBTranslation"/>.
        /// </summary>
        public RBTranslation() {
            Translation = string.Empty;
            Comment = string.Empty;
        }

        /// <summary>
        /// Initializes a new <see cref="RBTranslation"/>.
        /// </summary>
        /// <param name="translation">The translated text.</param>
        /// <param name="comment">The comment.</param>
        public RBTranslation(string translation, string comment) {
            Translation = translation;
            Comment = comment;
        }

        /// <summary>
        /// Returns the translated text.
        /// </summary>
        /// <returns>
        /// A <see cref="T:System.String"/> that represents the current <see cref="T:System.Object"/>.
        /// </returns>
        public override string ToString() {
            return Translation;
        }
    }
    /// <summary>
    /// Compares entries in a dictionary by name.
    /// </summary>
    public class ObservableTranslationDictionaryComparer : IComparer<DictionaryEntry> {
        CaseInsensitiveComparer comp = new CaseInsensitiveComparer();
        public int Compare(DictionaryEntry x, DictionaryEntry y) {
            return comp.Compare((x.Value as RBTranslation).Translation, (y.Value as RBTranslation).Translation);
        }
    }
}
